<extend name="Public:index" />
<block name="main-crumb">
    <li class="active">传感器增加</li>
</block>
<block name="mycss">
    <link href="__PUBLIC__/assets/plugins/colorpicker/asColorPicker.min.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/assets/css/style.css" rel="stylesheet" type="text/css" />
    <style>
    .state_text{
        vertical-align: -webkit-baseline-middle;  
    }
    </style>
</block>

<block name="main-content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-body">
                        <form id="add_form" name="add_form" action="{:U(\'sensor_edit\')}" method="post">
                            <table class="table table-bordered mb-0 table-centered">
                                <tr>
                                    <td width="20%" class="tableleft">末端设备名称：</td>
                                    <td>
                                        <input type="text" name="data[sensor_name]" id="sensor_name" value="{$datalist.sensor_name}"
                                            class="form-control" />
                                    </td>
                                </tr>
                                 <tr>
                                    <td class="tableleft">是否计入统计：</td>
                                    <td>
                                       <div class="checkbox checkbox-success">
                                                    <input id="is_count" class="min_input" name="data[is_count]" type="checkbox" <if condition="$datalist[is_count] gt 0">checked</if>>
                                                    <label for="is_count">
                                                    计入
                                                    </label>
                                            </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="tableleft">末端设备ID：</td>
                                    <td>
                                        <input type="text" name="data[sensor_code]" id="sensor_code" value="{$datalist.sensor_code}"
                                            class="form-control" />

                                    </td>
                                </tr>
                                 <tr>
                                    <td class="tableleft">末端设备背景色：</td>
                                    <td >
                                            <div class="">
                                        <input type="text"  name="data[sensor_color]" class="colorpicker form-control" id="sensor_color" value="{$datalist.sensor_color}" /> 
                                    </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="tableleft">说明：</td>
                                    <td>
                                        <textarea class="form-control" rows="5" id="sensor_dec" name="data[sensor_dec]"
                                            >{$datalist.sensor_dec}</textarea>
                                    </td>
                                </tr>

                                
                               
                                <tr>
                                    <td class="tableleft">末端设备参数：</td>
                                    <td>
                                        <button type="button" class="btn btn-primary waves-effect waves-light"
                                            data-toggle="modal" data-animation="bounce" data-target="#editModal">设置</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3">
                                        <input type="hidden" name="tijiao" id="tijiao" />
                                        <input type="hidden" name="id" value="{$datalist.id}" />
                                        <input type="submit" class="btn btn-primary waves-effect" id="sub" name="sub"
                                            value="保存" />&nbsp;&nbsp;&nbsp;&nbsp;
                                        <input type="reset" class="btn btn-success" value="清空" />
                                    </td>
                                </tr>

                            </table>
                        </form>
                            <div class="modal fade bd-example-modal-xl" id="editModal" tabindex="-1" role="dialog"
                                aria-labelledby="editModal" aria-hidden="true">
                                <div class="modal-dialog modal-xl" role="document">
                                    <div class="modal-content">


                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

</block>                       
<block name="myscript">
    <script src="__PUBLIC__/assets/plugins/repeater/jquery.repeater.min.js"></script>     
    <script src="__PUBLIC__/assets/plugins/colorpicker/jquery-asColor.js"></script>
    <script src="__PUBLIC__/assets/plugins/colorpicker/jquery-asColorPicker.min.js"></script>  
    <script src="__PUBLIC__/assets/plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
    <script src="__PUBLIC__/web/js/common.js"></script>
    <script>
       
        $('#editModal').on('show.bs.modal', function (e) {

            var sensor_code = "{$datalist.sensor_code}";
            var url = "{:U('sensor_param','','')}/sensor_code/" + sensor_code;
            $.ajax({
                type: 'GET',
                url: url
            }).then(function (data) {
                $('.modal-content').html(data);

            });
        });
          //colorpicker start

      $(".colorpicker").asColorPicker();



    </script>
</block>